import request from '@/utils/request';
import type { DetailParams, PlanParams, PlanStatusOptions, StatusParams } from './data';

// 获取列表数据
export async function getTable(params?: PlanParams) {
  return request('/v1/sem/plan/list', {
    method: 'POST',
    data: params,
  });
}

// 获取第三方平台
export async function getPlatForms(params?: {}) {
  return request('/v1/sem/plan/getPlatforms', {
    method: 'POST',
    params
  })
}

// 获取第三方状态
export async function getPlatStatus(params?: PlanStatusOptions) {
  return request('/v1/sem/plan/getPlatformStatus', {
    method: 'POST',
    data: params
  })
}

// 导出数据
export async function planExport(params?: PlanParams) {
  return request('/v1/sem/plan/export', {
    method: 'POST',
    data: params,
    responseType: 'blob'
  })
}

// 单一启用停用
export async function changeStatus(params: StatusParams) {
  return request('/v1/sem/plan/status', {
    method: 'POST',
    data: params
  })
}

// 单一删除计划
export async function delPlan(params: number[]) {
  return request('/v1/sem/plan/delete', {
    method: 'POST',
    data: params
  })
}